// import 'package:flutter_local_notifications/flutter_local_notifications.dart';
//
// class DownloadNotificationManager {
//   static final DownloadNotificationManager _instance = DownloadNotificationManager._internal();
//   factory DownloadNotificationManager() => _instance;
//   DownloadNotificationManager._internal();
//
//   final FlutterLocalNotificationsPlugin _notificationsPlugin = FlutterLocalNotificationsPlugin();
//   int _notificationId = 0;
//
//   Future<void> init() async {
//     const AndroidInitializationSettings initializationSettingsAndroid =
//     AndroidInitializationSettings('@mipmap/ic_launcher');
//
//     const InitializationSettings initializationSettings = InitializationSettings(
//       android: initializationSettingsAndroid,
//       iOS: DarwinInitializationSettings(),
//     );
//
//     await _notificationsPlugin.initialize(initializationSettings);
//   }
//
//   Future<void> showDownloadProgress({
//     required String title,
//     required String vid,
//     required int progress,
//     String? savePath,
//   }) async {
//     _notificationId++;
//
//     final AndroidNotificationDetails androidNotificationDetails =
//     AndroidNotificationDetails(
//       'download_channel',
//       '下载通知',
//       channelDescription: '显示下载进度',
//       importance: Importance.max,
//       priority: Priority.high,
//       ongoing: true,
//       onlyAlertOnce: true,
//       showProgress: true,
//       maxProgress: 100,
//       progress: progress,
//       playSound: false,
//     );
//
//     final NotificationDetails notificationDetails = NotificationDetails(
//       android: androidNotificationDetails,
//     );
//
//     await _notificationsPlugin.show(
//       _notificationId,
//       title,
//       progress < 100 ? '下载中... ${progress}%' : '下载完成',
//       notificationDetails,
//     );
//   }
//
//   Future<void> cancelNotification() async {
//     await _notificationsPlugin.cancel(_notificationId);
//   }
// }
